#pragma once

#include "StateBase.h"

class CStateGraph : public CStateBase
{
	DECLARE_RTTI_CLASS( CState, CStateBase::GetRTTI( ) );	
	
	//================================== METHODS ==============================

public:
	//! Constructor method
	CStateGraph(const CStateDataPtr &pStateData);
	//! Constructor method
	CStateGraph(const char_t *szName);
	//! Set current state
	void SetCurrentState(const CStateBasePtr &pState, CStateResult *pStateResult);	
	//! Add state
	void AddState(const CStateBasePtr &pState);
	//! Set initial state
	void SetInitialState(const CStateBasePtr &pState);

protected:
	//! Process state
	virtual void DoUpdate(CStateResult *pResult);
 
	//================================ DATA MEMBERS ===========================

protected:
	//! Child state list
	TStateList m_pStates;
	//! Current state
	CStateBasePtr m_pCurrentState;
	//! Initial state
	CStateBasePtr m_pInitialState;
	//! Result state data
	CStateResult m_stateResult;
};

typedef SmartPtr<CStateGraph> CStateGraphPtr;
